home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1 / Ian and Stuart's One (Australia).iso / Australasian Legends / Commercial / Rainbow Hill / MacDOS™ 2.0.0 / batches / dupldir.bat < prev    next >
DOS Batch File  |  1994-07-01  |  1KB  |  52 lines

  1. @echo off
  2. !  dupldir.bat    Batch file to duplicate a folder
  3. !
  4. !  dupldir name
  5. !
  6. !  where 'name' is the folder to be duplicated. The name can be preceded by
  7. !  a path and a volume ID.
  8. !
  9. !  dupldir.bat calls uniqueName and extractPath
  10. !
  11. !  Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
  12. !
  13.  
  14.     ! ensure that the first parameter is there and that the second one is not
  15.     set doserr=13
  16.     if not "%2 " == " " goto ERR_LBL
  17.     if "%1 " == " " goto ERR_LBL
  18.  
  19.     ! ensure that the requested folder is there
  20.     set doserr=27
  21.     if not existdir "%1" goto ERR_LBL
  22.  
  23.     ! make the new name and check that it is valid
  24.     call uniqueName "%1" dupldir_newName
  25.     if not %doserr% == 0 goto ERR_LBL
  26.  
  27.     ! do the actual duplication
  28.     call extractPath "%1" dupldir_path
  29.     if not %doserr% == 0 goto ERR_LBL
  30.     if "%dupldir_path%" == %%DUPLDIR_PATH%% goto WITHOUT_PATH_LBL
  31.     incr dupldir_path by "%dupldir_newName%"
  32.     goto DO_COPY_LBL
  33. :WITHOUT_PATH_LBL
  34.     set dupldir_path=%dupldir_newName%
  35. :DO_COPY_LBL
  36.     if existdir "%dupldir_path%" goto DIR_THERE_LBL
  37.     mkdir "%dupldir_path%"
  38. :DIR_THERE_LBL
  39.  
  40.     ! do the copying
  41.     xcopy/e "%1" "%dupldir_path%"
  42.     set doserr=0
  43.     goto DONE_LBL
  44.  
  45. :ERR_LBL
  46.     show %doserr%
  47.  
  48. :DONE_LBL
  49.     ! remove the global variables
  50.     set dupldir_newName=
  51.     set dupldir_path=
  52.